package cn.itcast.crm.service;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import cn.itcast.crm.domain.Customer;

public interface CustomerService {

	// 查询所有未关联客户列表
	@GET
	@Path("/findNoAssociationCustomers")
	@Produces({"application/xml","application/json"})
	public List<Customer> findNoAssociationCustomers();

	// 已经关联到指定定区的客户列表
	// @PathParam需要指定@Path("/findNoAssociationCustomers/{fixedAreaId}")
	@GET
	@Path("/findHasAssociationFixedAreaCustomers/{fixedAreaId}")
	@Consumes({"application/xml","application/json"})
	@Produces({"application/xml","application/json"})
	public List<Customer> findHasAssociationFixedAreaCustomers(@PathParam("fixedAreaId") String fixedAreaId);

	// 将客户关联到定区上 ， 将所有客户id 拼成字符串 1,2,3，使用@QueryParam实现
	// @QueryParam 不需要指定@Path("/associationCustomersToFixedArea")，在传递多个参数的时候，开发效率高
	@PUT
	@Path("/associationCustomersToFixedArea")
	@Consumes({"application/xml","application/json"})
	public void associationCustomersToFixedArea(@QueryParam("customerIdStr") String customerIdStr,@QueryParam("fixedAreaId") String fixedAreaId);
	
	//注册完成客户的保存
	@POST
	@Path("/customer")
	@Consumes({"application/xml","application/json"})
	public void regist(Customer customer);
	
	//根据电话号码查询客户
	@GET
	@Path("/customer/telephone/{telephone}")
	@Consumes({"application/xml","application/json"})
	@Produces({"application/xml","application/json"})
	public Customer findCustomerByTelephone(@PathParam("telephone") String telephone);
	
	//更新客户的type类型为1
	@PUT
	@Path("/updatetype/telephone/{telephone}")
	@Consumes({"application/xml","application/json"})
	public void updateType(@PathParam("telephone") String telephone);
	
	//根据用户手机号和密码查询用户
	@GET
	@Path("/customer/findCustomerByTelephoneAndPassword")
	@Consumes({"application/xml","application/json"})
	@Produces({"application/xml","application/json"})
	public Customer findCustomerByTelephoneAndPassword(@QueryParam("telephone") String telephone,@QueryParam("password") String password);
	//根据客户id和客户地址查询定区id
	@GET
	@Path("/customer/findFixedAreaIdByAddressAndCustomerId")
	@Consumes({"application/xml","application/json"})
	@Produces({"application/xml","application/json"})
	public String findFixedAreaIdByAddressAndCustomerId(@QueryParam("address") String address,@QueryParam("customerId") Integer customerId);
}
